var NS = NS || {};

//create a namespace
NS.namespace = function(ns_string) {
    var parts = ns_string.split('.'),
        parent = NS,
        i;

    //strip redundant leading global
    if(parts[0] === "NS") {
        parts = parts.slice(1);
        console.log("slice ", parts);
    }

    for(i = 0; i < parts.length; i += 1) {

        //create a property if it doesn't exist
        if(typeof parent[parts[i]] === "undefined") {
            parent[parts[i]] = {};
        }

        parent = parent[parts[i]];
    }
    return parent;
};